<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		
		<!--<script>
		
			try{
				document.forms.input.length;
			}catch(exception){
				alert("错误信息为:"+exception.message+"\n错误类型字符串为："+exception.name);
			}finally{
				alert("结束try...catch...finally语句");
			}
		
		
		
		
		
		
		</script>-->
	
		
	<!--判断参数个数和除数是否为0	-->
	
	<script language="JavaScript">
		
		function test(num1,num2){
			try{
				if(arguments.length<2){
					throw new Error("参数个数不够");
				}
				if(num1/num2=="infinity"){
					throw new Error("除数不能为0")
				}
			}catch(exception){
				alert(exception.message);
			}
		}
		
		
		
		
		
		
		
		
		
		
		
	</script>
		
		
		
		
		
		
		
	</head>
	<body>
	<script language="JavaScript">
		
		test(1);
		test(1,0);
		
	</script>
	
	
	</body>
</html>
